package hu.debrecen.adastra.card.service.impl;

import hu.debrecen.adastra.card.repository.domain.Account;
import hu.debrecen.adastra.card.service.AbstractGame;
import hu.debrecen.adastra.card.service.PlayerStatisticsService;
import hu.debrecen.adastra.card.service.domain.Card;
import hu.debrecen.adastra.card.service.domain.HungarianCard;
import hu.debrecen.adastra.card.service.domain.HungarianDeck;
import hu.debrecen.adastra.card.service.domain.PlayerState;
import hu.debrecen.adastra.card.web.domain.ZsirGameStateVO;

import java.util.LinkedList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SnapszerCardGame extends AbstractGame<HungarianCard> {

	private static final Logger LOGGER = LoggerFactory.getLogger(SnapszerCardGame.class);

	private static final int CARD_IN_HAND = 5;

	public enum Action {
		OPPONENT_CALLED, CALLED, HIT, LOST, WAITING
	}

	public SnapszerCardGame(final String gameId, final Account owner, final PlayerStatisticsService playerStatisticsService) {
		this(gameId, new HungarianDeck(), owner, playerStatisticsService);
	}

	public SnapszerCardGame(final String gameId, final HungarianDeck deck, final Account owner, final PlayerStatisticsService playerStatisticsService) {
		super(gameId, owner, deck, 2, playerStatisticsService);
	}

	@Override
	public void call(final Account player, final String type, final String suit) {
		// TODO Auto-generated method stub

	}

	@Override
	protected ZsirGameStateVO getGameState(final Account player) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected PlayerState getDefaultPlayerState() {

		List<Card> cards = new LinkedList<Card>();
		for (int i = 0; i < SnapszerCardGame.CARD_IN_HAND; i++) {
			cards.add(this.getDeck().nextCard());
		}

		return new PlayerState(cards);
	}

}
